﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:view="clr-namespace:Pvp.App.View">
    <Style x:Key="MainWindowResizeGripStyle" TargetType="{x:Type ResizeGrip}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ResizeGrip}">
                    <Rectangle Fill="Transparent" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="TitleBarButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Width" Value="18"/>
        <Setter Property="Height" Value="16"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition From="Normal" GeneratedDuration="0:0:0.2" To="MouseOver"/>
                                    <VisualTransition GeneratedDuration="0:0:0.2" To="Normal"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="glow">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="pressed">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="Content">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0.9"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="Content">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0.9"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border BorderThickness="1" CornerRadius="3">
                            <Border.Background>
                                <RadialGradientBrush GradientOrigin="0.436,0.566" RadiusY="0.588" RadiusX="0.588">
                                    <GradientStop Color="#FF9C9C9C" Offset="0"/>
                                    <GradientStop Color="#FFD6D6D6" Offset="1"/>
                                </RadialGradientBrush>
                            </Border.Background>
                            <Border.BorderBrush>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FF747474" Offset="0"/>
                                    <GradientStop Color="#FF5A595A" Offset="1"/>
                                </LinearGradientBrush>
                            </Border.BorderBrush>
                            <Grid>
                                <Border x:Name="glow" CornerRadius="3" Opacity="0" >
                                    <Border.Background>
                                        <RadialGradientBrush GradientOrigin="0.436,0.566" RadiusY="0.588" RadiusX="0.588">
                                            <GradientStop Color="#FFF8F1CA" Offset="0"/>
                                            <GradientStop Color="#FFDC9847" Offset="1"/>
                                        </RadialGradientBrush>
                                    </Border.Background>
                                </Border>
                                <Border x:Name="pressed" CornerRadius="3" Opacity="0" >
                                    <Border.Background>
                                        <RadialGradientBrush GradientOrigin="0.436,0.566" RadiusY="0.588" RadiusX="0.588">
                                            <GradientStop Color="#FFEFE6B0" Offset="0"/>
                                            <GradientStop Color="#FFAD8752" Offset="1"/>
                                        </RadialGradientBrush>
                                    </Border.Background>
                            
                                </Border>
                            </Grid>
                        </Border>
                        <ContentPresenter x:Name="Content" Content="{TemplateBinding Content}" 
                            HorizontalAlignment="Center" Margin="{TemplateBinding Padding}" 
                            RecognizesAccessKey="True"
                            SnapsToDevicePixels="True"
                            VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
                            <ContentPresenter.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform/>
                                    <SkewTransform/>
                                    <RotateTransform/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </ContentPresenter.RenderTransform>
                        </ContentPresenter>		
                    </Grid>
                    
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="TitleBarButtonStyle_Close" TargetType="{x:Type Button}">
        <Setter Property="Width" Value="18"/>
        <Setter Property="Height" Value="16"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition From="Normal" GeneratedDuration="0:0:0.2" To="MouseOver"/>
                                    <VisualTransition GeneratedDuration="0:0:0.2" To="Normal"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="glow">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="pressed">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="Content">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0.9"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="Content">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0.9"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border BorderThickness="1" CornerRadius="3">
                            <Border.Background>
                                <RadialGradientBrush GradientOrigin="0.436,0.566" RadiusY="0.588" RadiusX="0.588">
                                    <GradientStop Color="#FFA26D7A" Offset="0"/>
                                    <GradientStop Color="#FFD4C1C1" Offset="1"/>
                                </RadialGradientBrush>
                            </Border.Background>
                            <Border.BorderBrush>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FF747474" Offset="0"/>
                                    <GradientStop Color="#FF5A595A" Offset="1"/>
                                </LinearGradientBrush>
                            </Border.BorderBrush>
                            <Grid>
                                <Border x:Name="glow" CornerRadius="3" Opacity="0" >
                                    <Border.Background>
                                        <RadialGradientBrush GradientOrigin="0.436,0.566" RadiusY="0.588" RadiusX="0.588">
                                            <GradientStop Color="#FFF8F1CA" Offset="0"/>
                                            <GradientStop Color="#FFDC9847" Offset="1"/>
                                        </RadialGradientBrush>
                                    </Border.Background>
                                </Border>
                                <Border x:Name="pressed" CornerRadius="3" Opacity="0" >
                                    <Border.Background>
                                        <RadialGradientBrush GradientOrigin="0.436,0.566" RadiusY="0.588" RadiusX="0.588">
                                            <GradientStop Color="#FFEFE6B0" Offset="0"/>
                                            <GradientStop Color="#FFAD8752" Offset="1"/>
                                        </RadialGradientBrush>
                                    </Border.Background>
                            
                                </Border>
                            </Grid>
                        </Border>
                        <ContentPresenter x:Name="Content" Content="{TemplateBinding Content}" 
                            HorizontalAlignment="Center" Margin="{TemplateBinding Padding}" 
                            RecognizesAccessKey="True"
                            SnapsToDevicePixels="True"
                            VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
                            <ContentPresenter.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform/>
                                    <SkewTransform/>
                                    <RotateTransform/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </ContentPresenter.RenderTransform>
                        </ContentPresenter>		
                    </Grid>
                    
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <SolidColorBrush x:Key="GrayBrush" Color="#FFC0C0C0"/>

    <Grid x:Key="LowestDetail" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="0.3*"/>
            <RowDefinition Height="10*"/>
            <RowDefinition Height="0.3*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.5*"/>
            <ColumnDefinition Width="7*"/>
            <ColumnDefinition Width="0.5*"/>
        </Grid.ColumnDefinitions>

        <Rectangle Grid.Column="1" Fill="Black"/>
        <Rectangle Grid.Row="2" Grid.Column="1" Fill="Black"/>

        <Grid Grid.Row="1" Grid.Column="1" Background="Black">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="4*"/>
                <ColumnDefinition Width="1*"/>
            </Grid.ColumnDefinitions>

            <Grid Grid.Column="1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="2*"/>
                    <RowDefinition Height="1.6*"/>
                    <RowDefinition Height="5*"/>
                    <RowDefinition Height="1.6*"/>
                    <RowDefinition Height="4*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="12*"/>
                    <ColumnDefinition Width="1*"/>
                </Grid.ColumnDefinitions>

                <Border Grid.Column="1" Background="{StaticResource GrayBrush}" CornerRadius="0,0,1,1" />
                <Border Grid.Column="1" Grid.Row="2" Background="{StaticResource GrayBrush}" CornerRadius="1" />
                <Border Grid.Column="1" Grid.Row="4" Background="{StaticResource GrayBrush}" CornerRadius="1,1,0,0" />
            </Grid>

            <Grid Grid.Column="0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="7*"/>
                    <ColumnDefinition Width="10*"/>
                    <ColumnDefinition Width="3*"/>
                </Grid.ColumnDefinitions>

                <Border Grid.Column="1" Background="White" CornerRadius="0" />
            </Grid>

            <Grid Grid.Column="2">
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="3*"/>
                    <ColumnDefinition Width="10*"/>
                    <ColumnDefinition Width="7*"/>
                </Grid.ColumnDefinitions>

                <Border Grid.Column="1" Background="White" CornerRadius="0" />
            </Grid>
        </Grid>
    </Grid>

    <Style x:Key="MainWindowStyle" TargetType="{x:Type view:MainWindow}">
        <Setter Property="AllowsTransparency" Value="True"></Setter>
        <Setter Property="WindowStyle" Value="None"></Setter>
        <Setter Property="Background" Value="Transparent"></Setter>
        <Setter Property="ResizeMode" Value="CanResizeWithGrip"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type view:MainWindow}">
                    <Border x:Name="PART_OuterBorder" BorderThickness="2" CornerRadius="2">
                        <Border.BorderBrush>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                                <GradientStop Color="#D4D0C8" Offset="0.0"/>
                                <GradientStop Color="#716F64" Offset="1.0"/>
                            </LinearGradientBrush>
                        </Border.BorderBrush>
                        
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"></RowDefinition>
                                <RowDefinition Height="*"></RowDefinition>
                            </Grid.RowDefinitions>

                            <Border x:Name="PART_TitleBar" CornerRadius="2,2,0,0">
                                <Border.Background>
                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                        <GradientStop Color="#F0F0F0" Offset="0.0"/>
                                        <GradientStop Color="#A29A9A" Offset="1.0"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>

                                    <Border x:Name="PART_AppIcon_Pixels" Margin="4,1,0,1" Width="16" Height="16" Grid.Column="0" Child="{StaticResource LowestDetail}" />

                                    <TextBlock Grid.Column="1" Padding="5" Text="{TemplateBinding Title}" FontWeight="Bold"/>

                                    <StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0">
                                        <Button x:Name="PART_MinimizeButton" Margin="0"
                                            Style="{StaticResource TitleBarButtonStyle}" >
                                            <Path Stroke="Black" StrokeThickness="2">
                                                <Path.Data>
                                                    <PathGeometry>
                                                        <PathFigure StartPoint="0,8">
                                                            <LineSegment Point="10,8"/>	                              			
                                                        </PathFigure>	                               		
                                                    </PathGeometry>                                	
                                                </Path.Data>                                 
                                            </Path>
                                        </Button>
                                        <Button x:Name="PART_MaximizeButton" Margin="2,0,0,0" Style="{StaticResource TitleBarButtonStyle}" >
                                            <Path Stroke="Black" StrokeThickness="1">
                                                <Path.Data>
                                                    <PathGeometry>
                                                        <PathFigure StartPoint="0,9" IsClosed="True" IsFilled="False">
                                                            <PolyLineSegment Points="7,9 7,3 0,3"/>                              			
                                                        </PathFigure>
                                                        <PathFigure StartPoint="3,3" IsClosed="False" IsFilled="False">
                                                            <PolyLineSegment Points="3,0 10,0 10,7 7,7"/>                              			
                                                        </PathFigure>
                                                    </PathGeometry>                                	
                                                </Path.Data>                                 
                                            </Path>
                                        </Button>
                                        <Button x:Name="PART_CloseButton" Margin="2,0,0,0" Style="{StaticResource TitleBarButtonStyle_Close}">
                                            <Path Stroke="Black" StrokeThickness="2" >
                                                <Path.Data>
                                                    <PathGeometry>
                                                        <PathFigure StartPoint="1,8" IsClosed="False" IsFilled="False">
                                                            <LineSegment Point="8,1"/>                            			
                                                        </PathFigure>
                                                        <PathFigure StartPoint="1,1" IsClosed="False" IsFilled="False">
                                                            <LineSegment Point="8,8"/>                            			
                                                        </PathFigure>
                                                    </PathGeometry>                                	
                                                </Path.Data>                                 
                                            </Path>
                                        </Button>
                                    </StackPanel>
                                </Grid>
                            </Border>
                            
                            <Border x:Name="PART_VideoArea" BorderThickness="0" Grid.Row="1">

                                <AdornerDecorator>
                                    <ContentPresenter/>
                                </AdornerDecorator>

                            </Border>

                            <Rectangle x:Name="PART_ResizeGrip_Width" Grid.RowSpan="2" Cursor="SizeWE" Fill="Transparent" Width="5" 
                                       VerticalAlignment="Stretch" HorizontalAlignment="Right"></Rectangle>
                            <Rectangle x:Name="PART_ResizeGrip_Height" Grid.Row="1" Cursor="SizeNS" Fill="Transparent" Height="5" 
                                       HorizontalAlignment="Stretch" VerticalAlignment="Bottom"></Rectangle>
                            <ResizeGrip x:Name="PART_ResizeGrip" Grid.Row="1"
                                        Style="{StaticResource MainWindowResizeGripStyle}"
                                        HorizontalAlignment="Right"
                                        VerticalAlignment="Bottom"
                                        Width="5" Height="5"
                                        IsTabStop="False"/>

                        </Grid>

                    </Border>
                    
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMaximized" Value="True">
                            <Setter TargetName="PART_OuterBorder" Property="BorderThickness" Value="0"/>
                            <Setter TargetName="PART_ResizeGrip_Width" Property="IsEnabled" Value="False"/>
                            <Setter TargetName="PART_ResizeGrip_Height" Property="IsEnabled" Value="False"/>
                            <Setter TargetName="PART_ResizeGrip" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="IsFullScreen" Value="True">
                            <Setter TargetName="PART_OuterBorder" Property="BorderThickness" Value="0"/>
                            <Setter TargetName="PART_ResizeGrip_Width" Property="IsEnabled" Value="False"/>
                            <Setter TargetName="PART_ResizeGrip_Height" Property="IsEnabled" Value="False"/>
                            <Setter TargetName="PART_ResizeGrip" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_TitleBar" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>